import java.util.Optional;
import java.util.Scanner;

public class Main {
    public static Scanner scanf = new Scanner(System.in);
    public static InMoney inMoney = new InMoney();
    public static OutMoney outMoney = new OutMoney();
    public static double money = 0;

    public static void main(String[] args) {
        System.out.println("Your name is 19LQJ");
        System.out.println("Please type your password:");
        while (scanf.hasNextLine()) {
            if (scanf.nextLine().equals("123456")) {
                System.out.println("loginSuccessfully");
                loginSuccessfully();
            } else System.out.println("密码错误，请重新输入密码");
        }

    }

    public static void loginSuccessfully() {
        System.out.println("-------------------Welcome to the world's best ATM Money System!------------- ");
        System.out.println("-------------------Please select the corresponding number to play（Main Menu）------------- ");
        System.out.println("--1.存款--2.取款--3.查看余额--4.打印账单--5.exit------ ");

        while (scanf.hasNextLine()) {
            String str = scanf.nextLine();
            if (str.equals("1")) {
                money=inMoney.inMoney(money);
            } else if (str.equals("2")) {
                money=outMoney.outMoney(money);
            } else if (str.equals("3")) {
                System.out.println("您的余额为" + money + "元");
            } else if (str.equals("4")) {
                System.out.println("账单正在打印...");
                System.out.println("账单打印完毕，请取出");
            } else if (str.equals("5")) {
                System.out.println("GoodBye~ We're looking forward to see you next time.");
                System.exit(0);
            } else {
                System.out.println("您输入的信息有误！请重新输入！");
            }

            System.out.println("-------------------Welcome to the world's best ATM Money System!------------- ");
            System.out.println("-------------------Please select the corresponding number to play（Main Menu）------------- ");
            System.out.println("--1.存款--2.取款--3.查看余额--4.打印账单--5.exit------ ");
        }

    }
}
